how to do sum of array elements in javascript